﻿#ifndef SERVICE_H
#define SERVICE_H

/*
 * 这个类进行对百度云的访问，数据获取等操作
 *
*/

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>

struct TOCKEN{
    char tocken[1024];
    qint64 tocken_in;
};


class Service : public QObject
{
    Q_OBJECT
public:
    explicit Service(QObject *parent = nullptr);

signals:


public slots:
    QString getAccessToken(const QString &ak, const QString &sk);              //获取access token
    QStringList getCardId(const QString& fileName);                            //获取车牌号
private:
    qint64 save();                                                                //tocken保存到文件
    qint64 load();                                         //从文件读取tocken
private:
    QNetworkAccessManager manger;
    QByteArray tocken;
    qint64 tocken_in;
    QString ak;                                             //从百度云获取到的AK
    QString sk;                                             //从百度云获取到的SK
};

#endif // SERVICE_H
